home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 7 / FM Towns Free Software Collection 7.iso / taropyon / guilib3 / inc / cnslib.h < prev    next >
C/C++ Source or Header  |  1993-11-30  |  6KB  |  177 lines

  1. /*    :*****************************************************************
  2.     :    "cnslib.h"    :    system“Pride”コンソール・ライブラリ
  3.     :*****************************************************************
  4. */
  5. #ifndef    _CNS_H
  6. #define    _CNS_H
  7.  
  8. #ifndef    _GUIDEFS_H
  9. #    include    "guidefs.h"
  10. #endif
  11.  
  12. typedef    struct    _cnslin_t
  13. {    struct _cnslin_t    *next;
  14.     struct _cnslin_t    *prev;
  15.     size_t                len;
  16.     size_t                ln;        /* 表示行数        */
  17.     char                p[1];
  18. } CNSLIN_T;
  19.  
  20. typedef    struct                    /* テキスト位置構造体    */
  21. {    size_t        lnL;            /* 行番号(論理)        */
  22.     size_t        lnD;            /* 行番号 (表示)        */
  23.     size_t        lnDn;            /* 先頭(表示)行番号        */
  24.     size_t        ofs;            /* 行頭からのオフセット    */
  25. } CNSPOS_T;
  26.  
  27. #define    CNS_COLTBL_NUM    (32)
  28.  
  29. typedef    struct _cns_t
  30. {
  31.     int            page;            /* 書き込みページ            */
  32.     FRAME        fr;                /* 表示座標                    */
  33.     FRAME        tFr;            /* 文字表示範囲                */
  34.     COLOR        colTbl[CNS_COLTBL_NUM];
  35.                                 /* カラーテーブル            */
  36.  
  37.     void    *ptr;                                /* 汎用ポインタ        */
  38.     void (*sttDsp_func)(struct _cns_t *);        /* 状態表示用関数    */
  39.     int  (*extCmd_func)(struct _cns_t *,int);    /* 拡張コマンド関数    */
  40.  
  41.     void (*scnFlushFunc)(struct _cns_t *,int,int);    /* not use    */
  42.     void (*dspLineFunc)(struct _cns_t *,int,int);    /* not use    */
  43.  
  44.     void (*putSpcFunc)(struct _cns_t *,int,int,int);
  45.     void (*putAnkFunc)(struct _cns_t *,int,int,int);
  46.     void (*putKanFunc)(struct _cns_t *,int,int,int);
  47.     void (*putCtrFunc)(struct _cns_t *,int,int,int);
  48.     void (*putMakFunc)(struct _cns_t *,int,int,int);
  49.  
  50.     UCHAR        fntX,fntY;        /* フォントサイズ            */
  51.     UCHAR        spcX,spcY;        /* 字間                        */
  52.     SHORT        xsL;            /* 横文字数(右マージン)    */
  53.     SHORT        xsD;            /* 表示文字数                */
  54.     SHORT        xofs;            /* 横表示開始位置            */
  55.     SHORT        tab;            /* タブサイズ                */
  56.     SHORT        dspXc, dspYc;    /* 表示可能文字数            */
  57.     SHORT        dspXm, dspYm;
  58.  
  59.     CNSLIN_T    *topLin;        /* バッファ先頭                */
  60.     CNSLIN_T    *lastLin;        /* 最終ライン                */
  61.  
  62.     CNSLIN_T    *dspLin;        /* 表示先頭                    */
  63.     CNSPOS_T     dspPos;        /* 表示先頭位置                */
  64.  
  65.     size_t         txtSize;        /* テキストサイズ            */
  66.     size_t         linMaxD;        /* 表示行数                    */
  67.     size_t         linMaxL;        /* 論理行数                    */
  68.  
  69.     CNSLIN_T    *curLin;        /* カーソル行                */
  70.     CNSPOS_T     curPos;        /* カーソル位置                */
  71.  
  72.     SHORT         curXm;            /* カーソルホールド位置        */
  73.     SHORT         curX, curY;    /* カーソル位置                */
  74.     char         curDsp;        /* カーソル表示状態            */
  75.     char         curDmy;        /* TDP で使用(underline)    */
  76.     char        _curDmy[2];
  77.  
  78.     char         selFlag;        /* 選択中                    */
  79.     char         selMode;        /* 選択モード                */
  80.     SHORT         selX;            /* 矩形選択開始X            */
  81.     CNSLIN_T    *selLin;        /* 選択開始 行ポインタ        */
  82.     CNSPOS_T     selPos;        /* 選択先頭位置                */
  83.  
  84.     CNSPOS_T    lastTouch;        /* 最終変更位置                */
  85.  
  86.     UINT         findAtt;        /* 検索属性                    */
  87.     CNSLIN_T    *findLin;        /* 検索行ポインタ            */
  88.     CNSPOS_T     findPos;        /* 検索先頭                    */
  89.     size_t         findLen;        /* 検索文字数                */
  90.     char        *searchStr;        /* 検索文字列                */
  91.     size_t        searchLen;
  92.  
  93.     size_t         homeY;            /* ホーム位置                */
  94.  
  95.     int            logFlag;
  96.     int            kanCode;        /* 第1バイト漢字コード        */
  97.     int            escRevers;        /* リバース                    */
  98.     int            escLevel;        /* エスケープシーケンス        */
  99.     int            escCode;        /* エスケープコード            */
  100.  
  101.     size_t        maxLinBuf;        /* コンソールモード最大行数    */
  102.     size_t        linBufSize;        /* 行バッファの文字数        */
  103.     int            cnsX, cnsY;        /* コンソール入力位置        */
  104.     int            cnsDspIgnore;    /* 表示禁止                    */
  105.     int            cnsSelStr;        /* 表示用のワーク            */
  106. } CNS_T;
  107.  
  108. #define    CNS_PUTSPC(_cns,_x,_y,_ch)    {    \
  109.     if ( !((_cns)->cnsDspIgnore) && ((_cns)->cnsY >= (_cns)->dspPos.lnD) && ((_y) < (_cns)->dspPos.lnD + (_cns)->dspYm) )    \
  110.         ((_cns)->putSpcFunc)((_cns),(_x),(_y),(_ch)&0xFF);    \
  111. }
  112. #define    CNS_PUTANK(_cns,_x,_y,_ch)    {    \
  113.     if ( !((_cns)->cnsDspIgnore) && ((_cns)->cnsY >= (_cns)->dspPos.lnD) && ((_y) < (_cns)->dspPos.lnD + (_cns)->dspYm) )    \
  114.         ((_cns)->putAnkFunc)((_cns),(_x),(_y),(_ch)&0xFF);    \
  115. }
  116. #define    CNS_PUTKAN(_cns,_x,_y,_ch)    {    \
  117.     if ( !((_cns)->cnsDspIgnore) && ((_cns)->cnsY >= (_cns)->dspPos.lnD) && ((_y) < (_cns)->dspPos.lnD + (_cns)->dspYm) )    \
  118.         ((_cns)->putKanFunc)((_cns),(_x),(_y),(_ch)&0xFFFF);    \
  119. }
  120. #define    CNS_PUTCTR(_cns,_x,_y,_ch)    {    \
  121.     if ( !((_cns)->cnsDspIgnore) && ((_cns)->cnsY >= (_cns)->dspPos.lnD) && ((_y) < (_cns)->dspPos.lnD + (_cns)->dspYm) )    \
  122.         ((_cns)->putCtrFunc)((_cns),(_x),(_y),(_ch)&0xFF);    \
  123. }
  124. #define    CNS_PUTMAK(_cns,_x,_y,_ch)    {    \
  125.     if ( !((_cns)->cnsDspIgnore) && ((_cns)->cnsY >= (_cns)->dspPos.lnD) && ((_y) < (_cns)->dspPos.lnD + (_cns)->dspYm) )    \
  126.         ((_cns)->putMakFunc)((_cns),(_x),(_y),(_ch)&0xFF);    \
  127. }
  128.  
  129. /*    "cns010.c"        ------------------------------------------------*/
  130. extern    int        CNS_set_dspFunc( CNS_T *cns );
  131. extern    CNS_T    *CNS_open(void);
  132. extern    void    CNS_close( CNS_T *cns );
  133.  
  134. /*    "cns011.c"        ------------------------------------------------*/
  135. extern    int        CNS_getMarginAdjust( CNS_T *cns );
  136. extern    void    CNS_setScnWork( CNS_T *cns );
  137. extern    int        CNS_setScnSize( CNS_T *cns, int x1, int y1, int x2, int y2 );
  138.  
  139. /*    "cns012.c"        ------------------------------------------------*/
  140. extern    int        CNS_changeScnSize( CNS_T *cns, int x1, int y1, int x2, int y2 );
  141.  
  142. /*    "cns013.c"        ------------------------------------------------*/
  143. extern    int        CNS_clearBuffer( CNS_T *cns );
  144.  
  145. /*    "cns014.c"        ------------------------------------------------*/
  146. extern    int            CNS_getStrXY( CNS_T *cns, char *buf, int len, int x, int y );
  147. extern    CNSLIN_T    *CNS_getLinPtr( CNS_T *cns, int lnD );
  148.  
  149. /*    "cnssetc.c"        ------------------------------------------------*/
  150. int        CNS_setc( CNS_T *cns, int x, int y, int ch );
  151.  
  152. /*    "cnsputc.c"        ------------------------------------------------*/
  153. extern    void    CNS_chkScroll( CNS_T *cns );
  154. extern    void    CNS_putAnk( CNS_T *cns, int x, int y, int ch );
  155. extern    void    CNS_putKan(CNS_T *cns, int x, int y, int sjis);
  156. extern    int        CNS_putc( CNS_T *cns, int ch );
  157.  
  158. /*    "cnsputs.c"        ------------------------------------------------*/
  159. extern    int        CNS_puts( CNS_T *cns, CONST char *s);
  160.  
  161. /*    "cnsflush.c"    ------------------------------------------------*/
  162. extern    int        CNS_flush( CNS_T *cns, int dspLn, int dspN );
  163.  
  164. /*    "cnsjump.c"        ------------------------------------------------*/
  165. extern    int        CNS_jump( CNS_T *cns, size_t lnD );
  166.  
  167. /*    "cnsnext.c"        ------------------------------------------------*/
  168. extern    int        CNS_nextLine( CNS_T *cns, int n );
  169.  
  170. /*    "cnsprev.c"        ------------------------------------------------*/
  171. extern    int        CNS_prevLine( CNS_T *cns, int n );
  172.  
  173. /*    "cnscur.c"        ------------------------------------------------*/
  174. extern    void    CNS_putCursor( CNS_T *cns, int on_off );
  175.  
  176. #endif
  177.